#ifndef _FNT_LOAD_THREAD_H_
#define _FNT_LOAD_THREAD_H_

#include <QThread>
#include <QColor>
#include <array>
#include "image.h"
#include "cubedata.h"
class Session;
struct LoadThreadShared;
struct CubeData;
struct LoadThreadPriv;

class Location;
class AnnotTree;



struct CacheThread;

class LoadThread: public QThread {
	Q_OBJECT;
	friend struct LoadThreadPriv;
	LoadThreadPriv*const priv;

	void run() override;

Q_SIGNALS:
	void threadWarning(const QString& msg);
	void threadError(const QString& msg);

	void sourcesReady();

	void cubeFinished();
	void updateProgress(int cur, int tot);

	public:
	LoadThread(Session* s);
	LoadThread(Session* s, const LoadThreadInput& input);
	~LoadThread();

	QVector<QString> sources() const;
	bool getBoundingBox(std::array<double, 6>* bbox) const;
	bool getMinVoxelSize(double* vsize) const;
	bool getVoxelSize(double* vsize) const;
	std::vector<std::pair<int, Cube>> getOutput();
	bool reallyFinished() const;
	void setupSources();
	void stop();

	bool setPosition(int ch, int idx, double x, double y, double z, double sight, const Cube& cur);
	void cancel();

	static LoadThreadShared* createShared();
	static void destroyShared(LoadThreadShared* lts);
};

#endif
